package com.xingceng.stock.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiceng.stock.entity.StockBlockRtInfo;
import com.xiceng.stock.vo.StockBlockRtInfoVO;
import com.xingceng.stock.enums.CodeEnum;
import com.xingceng.stock.exception.StockException;
import com.xingceng.stock.response.ResponseResult;
import com.xingceng.stock.service.StockBlockRtInfoService;
import com.xingceng.stock.mapper.StockBlockRtInfoMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
* @author ZYZ
* @description 针对表【stock_block_rt_info(股票板块详情信息表)】的数据库操作Service实现
* @createDate 2025-11-07 14:39:25
*/
@Service
@RequiredArgsConstructor
public class StockBlockRtInfoServiceImpl extends ServiceImpl<StockBlockRtInfoMapper, StockBlockRtInfo>
    implements StockBlockRtInfoService{

    private final StockBlockRtInfoMapper stockBlockRtInfoMapper;

    @Override
    public List<StockBlockRtInfoVO> sectorAllLimit() {
        //1.调用mapper接口获取数据 TODO 优化 避免全表查询 根据时间范围查询，提高查询效率
        List<StockBlockRtInfoVO> infos=stockBlockRtInfoMapper.sectorAllLimit();
        //2.组装数据
        if (CollectionUtils.isEmpty(infos)) {
           throw new StockException(CodeEnum.NO_RESPONSE_DATA);
        }
        return infos;
    }
}




